﻿using System;
using System.Threading;
using System.Data.SqlClient;
using TSharp.Core.Util;
using TSharp.Core.Threading;
using System.Runtime.CompilerServices;
using TSharp.Core.Osgi;
using TSharp.Core.Test;
using System.Web;
using System.Collections.Generic;
using Common.Logging;
using System.Text;
using TSharp.Core.Util.TypeConvert;
namespace TSharp.Core.Test
{

    class ThreadClass
    {

        static void Main(string[] args)
        {
            double[] test = new double[] { Math.PI,  2.0000000000, 3.00000000000001, 1, 4.123456 };
            foreach (var pi in test)
            {
                var p0 = pi*1000;
                var i = Convert.ToInt64(pi);
                Console.WriteLine("浮点格式，无分隔符（逗号）");
                Console.WriteLine("pi, Left {0, -25}", pi); // 3.1415926535897931
                Console.WriteLine("p0, Rt.  {0, 25}", p0); //        3.1415926535897931
                Console.WriteLine("pi, E    {0, 25:E}", pi); //               3.1416E+000
                Console.WriteLine("使用 E 和 F 格式，小数点后保留 n（此处为 4）位");
                Console.WriteLine("pi, E4   {0, 25:E4}", pi); //               3.1416E+000
                Console.WriteLine("pi, F4   {0, 25:F4}", pi); //                    3.1416
                Console.WriteLine("使用 G 格式，保留 4 位有效数字——如果需要请使用 E 格式");
                Console.WriteLine("pi, G4   {0, 25:G4}", pi); //                     3.142
                Console.WriteLine("p0, G4   {0, 25:G4}", p0); //                   3.142E4
                Console.WriteLine("N 和 C 格式带有逗号（分隔符），" +
                "默认小数点后保留两位，四舍五入。");
                Console.WriteLine("p0, N    {0, 25:N}", p0); //                 31,415.93
                Console.WriteLine("p0, N4   {0, 25:N4}", p0); //               31,415.9265
                Console.WriteLine("p0, C    {0,25:C}", pi); //                     $3.14
                Console.WriteLine("D 和 X 格式仅用于整型，" +
                "非整型将产生格式异常——X 指十六进制");
                Console.WriteLine("i,  D    {0, 25:D}", i); //                       123
                Console.WriteLine("i,  D7   {0, 25:D7}", i); //                   0000123
                Console.WriteLine("i,  X    {0, 25:X}", i); //                        7B
                Console.WriteLine("i,  X8   {0, 25:X8}", i); //                  0000007B
                Console.ReadKey();
            }

            Console.ReadLine();
        }
    }
}